package com.twu.biblioteca;

import java.util.ArrayList;

public class return_book {
    public boolean return_book(String holder,String book,ArrayList<book> book_list){
        for (int i =0; i< book_list.size();i++){
            if (book_list.get(i).getBookname().equals(book)&&book_list.get(i).getBookstatus()==1
                    &&book_list.get(i).getBookholder().equals(holder)){
                book_list.get(i).setBookstatus(0);
                book_list.get(i).setBookholder(null);
                System.out.println("Thank you for returning the book");
                return true;
            }
        }
        System.out.println("That is not a valid book to return");
        return false;
    }
}
